Skip to content

Conversation

@nacx
Copy link
Member

@nacx nacx commented Dec 3, 2025

Description

Add the configured scopes to the WWW-Authenticate headers. At initialization time, which is when the first authentication will occur, we don't have enough information to provide a fine-grained list of scopes, so the best we can do is to default to the ones defined in the protected resource metadata.

Related Issues/PRs (if applicable)

Fixes #1578

The addition of the header on 403 requests is implemented in #1482, but this issue can be closed as soon as this PR is merged, because we'll be compatible with the latest spec.

Special notes for reviewers (if applicable)

cc @zhaohuabing can you take a look?

@nacx nacx requested a review from a team as a code owner December 3, 2025 11:44
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 3, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.52%. Comparing base (6d7059c) to head (8ce366a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1608   +/-   ##
=======================================
  Coverage   83.51%   83.52%           
=======================================
  Files         137      137           
  Lines       11934    11936    +2     
=======================================
+ Hits         9967     9969    +2     
  Misses       1386     1386           
  Partials      581      581           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nacx nacx merged commit fb86c58 into envoyproxy:main Dec 3, 2025
30 checks passed
@nacx nacx deleted the www-auth-scopes branch December 3, 2025 15:14
Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nacx LGTM. Thanks!

It should be helpful to add a comment to the ScopeSupported API to highlight that it should be the minimal set of scopes necessary for basic functionality to avoid exposing all scopes in the session initialization stage.

The scopes_supported field is intended to represent the minimal set of scopes necessary
for basic functionality (see Scope Minimization),
with additional scopes requested incrementally through the step-up authorization flow steps
described in the Scope Challenge Handling section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: enhance the authorization flows with incremental scope consent

4 participants